package com.erlang.springbootconfig;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by IntelliJ IDEA.
 *
 * @author ZGQ
 */
@RestController
public class HelloController {

    @Value("${gender}")
    private String gender;
    @Value("${person.name}")
    private String name;
    @Value("${person.age}")
    private String age;
    @Value("${address[0]}")
    private String address;

    @Autowired
    private Environment env;
    @Autowired
    private Person person;

    @RequestMapping("hello")
    public String Hello() {
        System.out.println(gender);
        System.out.println(name);
        System.out.println(age);
        System.out.println(address);
        System.out.println("-----------------------");
        System.out.println(env.getProperty("gender"));
        System.out.println(person);
        return "hello ";
    }
}
